<?php  require_once('header.php'); ?>
<center><b><u>Video Server Installation</u></b></center>
<br>
<?
include "admin/conf.php";
$connection=mysql_connect($hostname, $user, $pass) or die(mysql_error());
$db=mysql_select_db($database, $connection) or die(mysql_error());
$create=$_POST['create'];

if ($create =="OK")
{
// CREATING PICS TABLE	
$query = "CREATE TABLE users (
  id int(11) NOT NULL auto_increment,
  username varchar(255) default NULL,
  email varchar(255) default NULL,
  facebook_uid varchar(128) default NULL,
  password varchar(255) default NULL,
  created_at datetime default NULL,
  updated_at datetime default NULL,
  is_deleted tinyint(1) default '0',
  PRIMARY KEY  (id)
  );";

$video_table="CREATE TABLE videos (
  id int(11) NOT NULL auto_increment,
  videoname varchar(255) default NULL,
  videocode text,
  counter int(11) default NULL,
  PRIMARY KEY  (id)
  );";
  mysql_query($video_table);

if(mysql_query($query)){
print "<center><b>SUCCESS !! </b> <br>The MySQL table <b><font color=\"#ff0000\"> $table </font></b> has been created and is ready for use.<br><br>";
}else {
          die("MySQL ERROR, ".mysql_error());
         }
echo "<font color='#ff0000'>Now,Remove install.php from your Server</font><br><a href='admin.php'>Open Admin Area</a></center>";
exit; 
}
?>
<p>This script will automatically create the MySQL tables .<br> 
<b>Edit admin/conf..php before this script can be run.</b><br> 
The 'Create Table' button will appear below if you've successfully given all
the info needed to do this.<br> 
  Please review the info below just to be sure:</p>
<p>Database Host:<b> <font color='red'><? print $hostname; ?></font></b><br>
  Database User: <b><font color='red'><? print $user; ?></font></b><br>
  Database Password: <b><font color='red'><? print $pass; ?></font></b><br>
  Database Name: <b><font color='red'><? print $database; ?></font></b><br>

<hr>

Admin Username = <font color='red'> <b><? print $AdminUsername; ?></b></font>
  <br>
Admin Password= <font color='red'>  <b><? print $AdminPassword; ?></b></font>
  <br>
Domain = <font color='red'>  <b><? print $domain; ?></b></font>
<br>
<br>

If this is all correct, click the 'Create Table' button below.<br>
If the button does not show below, it's because one-some of these fields are empty.</p>
<?
if ($hostname && $user && $pass && $database)
print "<form name=\"create_table\" action=\"install.php\" method=\"Post\">
<div align=\"center\">
<input type=\"hidden\" name=\"create\" value=\"OK\">
<input type=\"submit\" value=\"Create Table\">
</div>
</form>";

?>

